﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title></title>
<script type="text/javascript" src="../../_data/SysConfig.js"></script>
<script type="text/javascript" src="../../_libs/jquery-min.js"></script>
<script type="text/javascript" src="../../_libs/jquery.jtemplates.js"></script>
<script type="text/javascript" src="../../scripts/jumbotcms.js?v4"></script>
<link type="text/css" rel="stylesheet" href="../../style/global.css" />
<script type="text/javascript" src="../../admin/otherpage/styles/common.js"></script>
<link type="text/css" rel="stylesheet" href="../../admin/otherpage/styles/common.css" />
<script type="text/javascript">
function ajaxTopNav()
{
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"time="+(new Date().getTime()),
		url:		site.Dir + "admin/usergroup/ajax.aspx?oper=ajaxGetList",
		error:		function(XmlHttpRequest,textStatus, errorThrown) { alert(XmlHttpRequest.responseText);},
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				$("#ajaxTopNav").setTemplateElement("tplTopNav", null, {filter_data: true});
				$("#ajaxTopNav").processTemplate(d);
				break;
			}
		}
	});
}
var gid = joinValue('gid');//用户组ID
var keys=joinValue('keys');//关键字
var pagesize=15;
var page=thispage();
$(document).ready(function(){
	ajaxTopNav();
	ajaxList(page);

});
function ajaxList(currentpage)
{
	if(currentpage!=null) page=currentpage;
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"page="+currentpage+"&pagesize="+pagesize+"&time="+(new Date().getTime()),
		url:		"ajax.aspx?oper=ajaxGetList"+gid+keys,
        error:		function(XmlHttpRequest,textStatus, errorThrown) { alert(XmlHttpRequest.responseText);},
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				$("#ajaxList").setTemplateElement("tplList", null, {filter_data: true});
				$("#ajaxList").processTemplate(d);
				ActiveCoolTable();
				$("#ajaxPageBar").html(d.pagerbar);
				break;
			}
		}
	});
}
function operater(act,groupid){
	var ids = JoinSelect("selectID");
	if(ids=="")
	{
		top.JumbotCms.Alert("没有任何选择项", "0"); 
		return;
	}
	top.JumbotCms.Loading.show("正在处理...");
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"ids="+ids+"&togid="+groupid,
		url:		"ajax.aspx?oper=ajaxBatchOper&act="+act+"&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){top.JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				top.JumbotCms.Loading.hide();
				ajaxList(page);
				break;
			}
		}
	});
}
function ConfirmDel(id){
	top.top.JumbotCms.Confirm(site.UserItem+"删除后，与其相关的信息都将删除并不可复原，确定吗?", "IframeOper.ajaxDel("+id+")");
}
function ajaxDel(id){
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+id,
		url:		"ajax.aspx?oper=ajaxDel&time="+(new Date().getTime()),
		error:		function(XmlHttpRequest,textStatus, errorThrown){top.JumbotCms.Loading.hide();alert(XmlHttpRequest.responseText); },
		success:	function(d){
			switch (d.result)
			{
			case '-1':
				top.JumbotCms.Alert(d.returnval, "0", "top.window.location='" + site.Dir + "admin/login.htm';");
				break;
			case '0':
				top.JumbotCms.Alert(d.returnval, "0");
				break;
			case '1':
				ajaxList(page);
				break;
			}
		}
	});
}
function move2group(groupid){
	operater("move2group",groupid);
}
function ajaxSearch(){
	top.JumbotCms.Popup.show(site.Dir + "admin/user/searchform.aspx?state="+gid+keys,500,280,true);
}
</script>
</head>
<body>
<textarea id="tplTopNav" style="display:none">
<div class="topnav"> <span class="preload1"></span><span class="preload2"></span>
	<ul id="topnavbar">
		<li class="topmenu"><a href="javascript:void(0);" class="top_link"><span
            class="down">批量操作</span></a>
			<ul class="sub">
				<li><a href="javascript:void(0);" onclick="operater('pass')">启用</a></li>
				<li><a href="javascript:void(0);" onclick="operater('nopass')">禁用</a></li>
				<!--<li><a href="javascript:void(0);" onclick="operater('writer')">给予Writer权限</a></li>
				<li><a href="javascript:void(0);" onclick="operater('nowriter')">取消Writer权限</a></li>-->
				<li><a class="fly" href="javascript:void(0);" id="move2group">转移分组</a>
					<ul>
						{#foreach $T.table as record}
						<li><a href="javascript:void(0);" onclick="move2group({$T.record.id})"> {$T.record.groupname}</a></li>
						{#/for}
					</ul>
				</li>
			</ul>
		</li>
		<li class="topmenu"><a href="javascript:void(0);" onclick="ajaxSearch();" class="top_link"><span>过滤检索</span></a></li>
	</ul>
	<script>
	topnavbarStuHover();
        </script>
</div>
</textarea>
    <div id="ajaxTopNav"></div>
<textarea id="tplList" style="display:none">
<table class="cooltable">
<thead>
	<tr>
		<th align="center" scope="col" style="width:30px;"><input onclick="checkAllLine()" id="checkedAll" name="checkedAll" type="checkbox" /></th>
		<th scope="col" style="width:60px;">ID</th>
		<th width="*">用户名</th>
		<th style="width:75px;">用户组</th>
		<th scope="col" style="width:90px;">VIP有效期</th>
		<th scope="col" style="width:60px;">点数</th>
		<th scope="col" style="width:60px;">积分</th>
		<th scope="col" style="width:40px;">状态</th>
		<th scope="col" style="width:230px;">操作</th>
	</tr>
</thead>
<tbody>
	{#foreach $T.table as record}
	<tr>
		<td align="center"><input class="checkbox" name="selectID" type="checkbox" value='{$T.record.id}' /></td>
		<td align="center">{$T.record.id}</td>
		<td align="left">
			{$T.record.username}
			{#if $T.record.iswriter == "1"}
			<a title='真实姓名：{$T.record.truename}'><img src='{site.Dir}publicstyle/writer.gif' border='0' /></a>
			{#/if}
		</td>
		<td align="center"><a>{$T.record.groupname}</a></td>
		<td align="left">
			{#if $T.record.isvip == "1"}
			{formatDate($T.record.viptime,"yyyy-MM-dd")}
			{#/if}
			
		</td>
		<td align="center"><a>{$T.record.points}</a></td>
		<td align="center"><a>{$T.record.integral}</a></td>
		<td align="center">
			{#if $T.record.state == "1"}
			启用
			{#else}
			<font color='red'>已禁</font>
			{#/if}
		</td>
		<td align="center" class="oper">
			<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show(site.Dir + 'admin/user/preview.aspx?id={$T.record.id}',-1,-1,true)">详细信息</a>
           		<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show(site.Dir + 'admin/user/edit.aspx?id={$T.record.id}',450,280,true)">特殊处理</a>
			{#if $T.record.adminid == "0"}
          		<a href="javascript:void(0);" onclick="top.JumbotCms.Popup.show(site.Dir + 'admin/master/add.aspx?id={$T.record.id}',450,320,false)">升为管理员</a>
			{#else}
			<font color='#cccccc'>升为管理员</font>
			{#/if}
			<a href="javascript:void(0);" onclick="ConfirmDel({$T.record.id})">删除{site.UserItem}</a>
		</td>
	</tr>
	{#/for}
</tbody>
</table>
</textarea>
    <div id="ajaxList"></div>
    <div id="ajaxPageBar" class="pages"></div>
</body>
</html>
